{% extends 'dashboard/base.html' %}

{% block body %}
<link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.css" rel="stylesheet">

        <div class="row justify-content-md-center">
            <div class="col-8">
                <div class="card">
                    <div class="card-body">
                        <div class="d-md-flex align-items-center">
                            <h1 class="card-title">Upload Reports</h1>
                        </div>
                        <br>
                        <div class="card">
                            <div class="form-group">
                                <form class="form-horizontal" method="POST" enctype="multipart/form-data"
                                      action="{% url 'report_upload:upload' %}">{% csrf_token %}
                                    <div class="card-body">
                                        <h5 class="card-title"></h5>
                                        <div class="form-group row">
                                            <label class="col-md-3 m-t-15">Project</label>
                                            <div class="col-md-9">
                                                <select id="project_id" name="project_id"
                                                        class="select2 form-control custom-select"
                                                        style="width: 100%; height:36px;">
                                                    {% for data in all_project %}
                                                    <option value="{{data.uu_id}}">{{data.project_name}}</option>
                                                    {% endfor %}
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-md-3 m-t-15">Scanner</label>
                                            <div class="col-md-9">
                                                <select id="scanner" name="scanner"
                                                        class="select2 form-control custom-select"
                                                        style="width: 100%; height:36px;">
                                                    {% for parser in PARSER_DICT %}
                                                    <option value="{{ PARSER_DICT | get_codeName:parser }}">{{ PARSER_DICT | get_displayName:parser }}</option>
                                                    {% endfor %}
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-sm-3 control-label col-form-label">Target:</label>
                                            <div class="col-sm-9">
                                                <input type="text" name="target" class="form-control"
                                                       placeholder="Scan Target">
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-md-3">XML/JSON/HTML :</label>
                                            <div class="col-md-9">
                                                <input type="file" name="file">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-actions">
                                        <button type="submit" class="btn btn-success">Save</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="/static/matrix-admin-bt4/assets/libs/toastr/build/toastr.min.js"></script>
<script src="/static/matrix-admin-bt4/dist/js/custom.min.js"></script>

<script>
        $(window).load(function() {
            {% if messages %}
                {% for message in messages %}
                    {% if message.tags == 'alert-success' %}
                        toastr.success('{{ message }}');
                    {% endif %}
                    {% if message.tags == 'alert-danger' %}
                        toastr.error('{{ message }}');
                    {% endif %}
                {% endfor %}
            {% endif %}
        });
    </script>
{% endblock %}
